<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:include="layout :: htmlhead" th:with="title='用户管理'"></head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <!--头-->
    <div th:replace="fragments/head :: header"></div>

    <div class="layui-body" style="margin: 1%">

        <form id="templateSearch" class="layui-form layui-form-pane" method="post" action="" style="margin-top: 20px;">
            <div class="layui-form-item">
                <label class="layui-form-label">模板名</label>
                <div class="layui-input-inline">
                    <input id="qname" name="qname" autocomplete="off" class="layui-input" type="text"/>
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">注册时间</label>
                    <div class="layui-input-inline" style="width: 175px;">
                        <input name="qinsertTimeStart" id="qinsertTimeStart" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input" type="text"/>
                    </div>
                    <div class="layui-form-mid">-</div>
                    <div class="layui-input-inline" style="width: 175px;">
                        <input name="qinsertTimeEnd" id="qinsertTimeEnd" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input" type="text"/>
                    </div>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    <button class="layui-btn"  lay-submit="" lay-filter="searchSubmit">提交</button>
                </div>
            </div>
        </form>

        <!--<hr class="layui-bg-blue"/>-->
        <hr class="layui-bg-black"/>
        <shiro:hasPermission name="templateAdd">
            <button class="layui-btn layui-btn-normal" onclick="addTemplate()">新增</button>
        </shiro:hasPermission>
        <shiro:hasPermission name="templateUpload">
            <button class="layui-btn layui-btn-normal" onclick="uploadTemplate()">上传</button>
        </shiro:hasPermission>
        <table id="templateList" lay-filter="templateTable"></table>
        <script type="text/html" id="isDelTpl">
            {{#  if(!d.isDel){ }}
            <font color="green">正常</font>
            {{#  } else { }}
            <font color="red">删除</font>
            {{#  } }}
        </script>
        <script type="text/html" id="optBar">
            <shiro:hasPermission name="templateEdit">
                <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
            </shiro:hasPermission>
            {{#  if(d.isDel){ }}
            <shiro:hasPermission name="templateDelete">
                <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="recover">恢复</a>
            </shiro:hasPermission>
            {{#  } else { }}
            <shiro:hasPermission name="templateDelete">
                <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
            </shiro:hasPermission>
            {{#  } }}
        </script>
    </div>


    <!--添加或编辑模板-->
    <div id="setTemplate" class="layer_self_wrap" style="width:500px;display:none;text-align: center">
        <form id="templateForm" class="layui-form layui-form-pane" method="post" action="" style="margin-top: 20px;">
            <input id="pageNum" type="hidden" name="pageNum"/>
            <input id="id" type="hidden" name="id"/>
            <div class="layui-form-item">
                <label class="layui-form-label">模板名称</label>
                <div class="layui-input-inline">
                    <input id="name" name="name" lay-verify="required" autocomplete="off" class="layui-input" type="text"/>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">模板编码</label>
                <div class="layui-input-inline">
                    <input id="code" disabled="disabled" name="code" lay-verify="required" autocomplete="off" class="layui-input" type="text" />
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">模板内容</label>
                <div class="layui-input-inline">
                    <textarea id="content" name="content" lay-verify="required" autocomplete="off" class="layui-textarea"/>
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-input-block" style="margin-left: 10px;">
                    <button class="layui-btn"  lay-submit="" lay-filter="templateSubmit">提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
    </div>


    <!--批量导入模板信息-->
    <div id="uploadTemplateFile" class="layer_self_wrap" style="width:500px;display:none;text-align: center">
        <form id="uploadTemplateFileForm" class="layui-form layui-form-pane" method="post" action="" style="margin-top: 20px;">
            <input id="pageNumUpload" type="hidden" name="pageNum"/>
            <div class="layui-form-item">
                <label class="layui-form-label">请选择文件</label>
                <div class="layui-input-inline">
                    <input id="file"  accept=".xlsx" lay-verify="required" class="layui-input" type="file"/>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block" style="margin-left: 10px;">
                    <button class="layui-btn"  lay-submit="" lay-filter="uploadTemplateFileSubmit">提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary" onclick="downLoadTemplete()">下载模板</button>
                </div>
            </div>
        </form>
    </div>

    <!--底部-->
    <div th:replace="fragments/footer :: footer"></div>
    <script th:src="@{/js/dateUtils.js}"></script>
    <script th:src="@{/js/biz/msg/templateList.js}"></script>

</div>
</body>
</html>